<!DOCTYPE html>
<!-- 单行文本框的用户体验 -->

<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>

<script type="text/javascript" src="jquery.min.js"></script>
<script type="text/javascript">
	$(document).ready(function() {
		$("#name,#password").focus(function() {
			var val = $(this).val();
			if (val == this.defaultValue) {
				$(this).val("");
			}
		}).blur(function() {
			debugger;
			var val = this.value;
			if ($.trim(val) == "") {
				//this.value = this.defaultValue;
				$(this).css("background-color","red");
			}
		})
	})
</script>
</head>
<body>
<from>
 名称：<input type="text" id="name" value="用户名"><p>
 密码：<input type="password" id="password" value="***"><p>
  详细信息：<textarea></textarea>
     
</from>
	
</body>
</html>